package com.longjianghuasheng.logistics.business.mine.viewmodel

import androidx.lifecycle.MutableLiveData
import com.longjianghuasheng.logistics.base.BaseMultiStateViewModel
import com.longjianghuasheng.logistics.data.model.bean.ApiResponseNoData
import com.longjianghuasheng.logistics.ext.commit2
import com.longjianghuasheng.logistics.ext.toastNormal
import com.longjianghuasheng.logistics.repository.request.HttpRequestCoroutine

class FeedbackViewModel : BaseMultiStateViewModel() {
    var type = 0
    var content = ""
    val realPathList by lazy {
        mutableListOf<String>()
    }

    val result by lazy {
        MutableLiveData<ApiResponseNoData>()
    }


    fun feedback() {

        if (type == 0) {

            toastNormal("请选择类型")
            return
        }

        if (content.isBlank()) {

            toastNormal("请输入内容")
            return
        }
        if (realPathList.isNullOrEmpty()) {
            toastNormal("请选择图片")
            return
        }


        commit2({ HttpRequestCoroutine.feedback(type, content, realPathList) }, result)
    }
}